#define _CRT_SECURE_NO_WARNINGS 1
#include "heap.h"

int main()
{
	srand((unsigned int)time(NULL));
	Heap hp;

	int sz = 10;
	HPDataType* a = (HPDataType*)malloc(sz * sizeof(HPDataType));
	if (a == NULL)
	{
		perror("main::malloc file");
		return -1;
	}
	for (int i = 0; i < sz; i++)
	{
		a[i] = rand() + i;
		printf("%d ", a[i]);
	}
	printf("\n\n");

	HeapInit(&hp);
	HeapCreate(&hp, a, sz);
	HeapPush(&hp, 40000);
	HeapPush(&hp, 40000);
	HeapPush(&hp, 40000);
	HeapPop(&hp);
	HeapPop(&hp);
	for (int i = 0; i < hp.size; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n\n");

	while (HeapEmpty(&hp)!=1)
	{
		printf("%d ", HeapTop(&hp));
		HeapPop(&hp);
	}
	
	HeapDestroy(&hp);

	return 0;
}